import { each } from 'lodash'
import { nFormatter } from '@/utils/nFormatter'

export default {
  backgroundColor: '#1c213e',
  tooltip: {
    trigger: 'axis',
    appendToBody: true,
    formatter: function (val = []) {
      let _str = ''
      each(val, (item, index) => {
        const {
          value,
          seriesName,
          marker
        } = item
        if (index === 0) {
          const { name } = item
          _str += `${name}<br />`
        }
        _str += `${marker}${seriesName}: ${value}<br />`
      })
      return _str
    }
  },
  xAxis: {
    boundaryGap: false,
    splitLine: {
      lineStyle: {
        color: '#31597d',
        type: 'dashed'
      }
    },
    nameTextStyle: {
      color: '#fff'
    }
  },
  yAxis: {
    name: '用气量',
    type: 'value',
    splitLine: {
      lineStyle: {
        color: '#31597d',
        type: 'dashed'
      }
    },
    nameTextStyle: {
      color: '#fff'
    },
    axisLabel: {
      formatter: function (val) {
        return nFormatter(val)
      }
    }
  },
  series: [],
  grid: {
    left: '5%',
    right: '5%',
    bottom: 35
  }
}
